package com.jch.helloworld.configBeans.lifeCycle;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMain {

    public static void main(String[] args) {
        // 测试 bean的生命周期 | bean后置处理器
        ClassPathXmlApplicationContext cpxAc = new ClassPathXmlApplicationContext("/beans/beans-lifecycle.xml");
        // 获取 bean
        BeanDemo beanDemo = (BeanDemo) cpxAc.getBean("lifeCycleBean");
        System.out.println(beanDemo);
        // 关闭IOC容器，同时会销毁容器内的bean，bean在销毁时会调用自身指定的销毁方法
        cpxAc.close();
    }

}
